import {Card, Row, Col, List, Typography, Table, Tag} from "antd";
import Base from "@/pages/Province/SubjectDetail/components/Base";
import {FileWordOutlined} from "@ant-design/icons";
import {nanoid} from "@ant-design/pro-components";
import Pie from './components/Pie'
import {history} from "@@/core/history";
import {useEffect, useState} from "react";
import {Detail02Docx, Detail03Docx} from "@/services/Province/Dashboard";

export default (props) => {

  const urlArr = history.location.pathname.split('/')
  const school = urlArr[urlArr.length - 1]
  const subject = urlArr[urlArr.length - 2]
  const schoolSubject = school + '-' + subject
  const [uploadData, setuploadData] = useState([])
  const [award, setaward] = useState(0)
  const [reload, setReload] = useState(false)

  useEffect(() => {
    Detail03Docx({subject: schoolSubject}).then(res => {
      if (res.status === 0) {
        setuploadData(res.data)
        setaward(res.award)
      }
    })
  }, [reload])

  return <Base props={props}>
    <Row gutter={[24, 24]}>
      <Col span={24}><Card title="师德师风建设">
        <Typography.Text strong>
          <p className="good-content-size good-flex-center">自2021年1月1日至今，学科在师德师风建设中获奖人数：<Tag color="blue">{award}</Tag>人次</p>
        </Typography.Text>
        <List
          bordered
          dataSource={uploadData}
          renderItem={item => (
            <List.Item>
              <div>
                <Typography.Title level={4}> {item.title} </Typography.Title>
                <p className="good-content-size">{item.content}</p>
              </div>
            </List.Item>
          )}
        />
      </Card></Col>
    </Row>
  </Base>
}
